package edu.sctu.java.builder;

import java.util.function.Consumer;

public class Test02 {
    public static void main(String[] args) {


        // 方法2： 通过consumer对builder进行相关配置，而后由builder生成对象。
        User.Builder builder1 = new User.Builder();

        // (1) 接受consumer的配置；
        Consumer<User.Builder> builderConsumer = builder -> {
            builder.username("chen")
                    .gender("male")
                    .password("123");
        };
        builderConsumer.accept(builder1);

        // (2) 由builder生成；
        System.out.println(builder1.build());

    }
}
